<template>
	<view>
		<cu-custom :bgLinerBorder="true" :isBlack="false">
			<block slot="content">点餐记录</block>
		</cu-custom>
		<!-- <view class="contents" v-if="type==1">
			<view class="" v-for="(pItem,pIndex) in list" :key="pIndex">
				<view class="flex justify-space-between align-center m-b-10">
					<view class="f-18 orange fontBold">
						{{pItem.name}}
					</view>
					<view class="f-18 orange fontBold">
						￥{{pItem.total_price||0}}
					</view>
				</view>
				<view class="wrap flex m-b-10" v-for="(item,index) in pItem.goods" :key="index">
					<view class="flex align-center">
						<image :src="item.thumb_url" class="imgs" mode=""></image>
					</view>
					<view class="flex-1 p-l-10 flex flex-direction justify-space-between">
						<view class="f-17 fontBold">
							{{item.goods_name}}
						</view>
						<view class="">
							<view class="flex justify-space-between">
								<view class="f-12 black-9">
									<text v-if="item.goods_attr_str">规格：{{item.goods_attr_str}}</text>
								</view>
								<view class="f-12 nums">
									*{{item.goods_num}}
								</view>
							</view>
							<view class="flex justify-space-between">
								<view class="orange f-17 fontBold">
									￥{{item.price}}
								</view>
								<view class="orange f-17 fontBold">
									￥{{item.real_price}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="nodata" v-if="list.length == 0">
				暂无数据~
			</view>
		</view> -->
		<view class="contents">
			<view class="wrap flex m-b-10" v-for="(item,index) in list" :key="index">
				<view class="flex align-center">
					<image :src="item.thumb_url" class="imgs" mode=""></image>
				</view>
				<view class="flex-1 p-l-10 flex flex-direction justify-space-between">
					<view class="f-17 fontBold">
						{{item.goods_name}}
					</view>
					<view class="">
						<view class="flex justify-space-between">
							<view class="f-12 black-9">
								<text v-if="item.goods_attr_str">规格：{{item.goods_attr_str}}</text>
							</view>
							<view class="f-12 nums">
								*{{item.goods_num}}
							</view>
						</view>
						<view class="flex justify-space-between">
							<view class="orange f-17 fontBold">
								￥{{item.price}}
							</view>
							<view class="orange f-17 fontBold">
								￥{{item.real_price}}
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="nodata" v-if="list.length == 0">
				暂无数据~
			</view>
		</view>
		<view style="height: 130rpx;"></view>
		<view class="bottom-wrap flex justify-center">
			<view class="f-18 orange fontBold" >
				消费金额汇总：￥{{info.total_price}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:1,//1 tabbar列表进入  2餐厅接单进入
				id:0,
				info:{},
				list:[],
				page:1,
				last_page:1,
				total:0
			}
		},
		onLoad(option) {
			// if(option.type){
			// 	this.type = option.type;
			// }
			if(option.id){
				this.id = option.id;
			}
			this.getIndex();
		},
		onReachBottom(){
			// if(this.type == 1){
			// 	if(this.page >= this.last_page)return;
			// 	this.page++;
			// 	this.getIndex();
			// }
		},
		methods: {
			getIndex(){
				// if(this.type == 1){
				// 	let data = {
				// 		page:this.page,
				// 		user_id:this.id
				// 	}
				// 	this.$http('/apimanager/User/userOrderList',data).then(res=>{
				// 		if(res.code == 200){
				// 			let datas = res.data;
				// 			let list = datas.list.data;
				// 			this.last_page = datas.list.last_page;
				// 			if(this.page == 1){
				// 				this.total = datas.total;
				// 				this.list = list;
				// 			}else{
				// 				this.list = this.list.concat(list);
				// 			}
							
				// 		}
				// 	})
				// }else{
					let data = {
						order_id:this.id
					}
					this.$http('/apimanager/shop_manager/OrderInfo',data).then(res=>{
						if(res.code == 200){
							let datas = res.data;
							let list = datas.goods;
							this.info = datas.info;
							this.list = list;
						}
					})
				// }
			},
		}
	}
</script>

<style lang="less">
	.bottom-wrap {
		box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.07);
		border-radius: 20px 20px 0 0;
		height: 130rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 100;
		background: #ffffff;
		width: 100%;
		padding: 20rpx 30rpx 0 30rpx;
	}
	.wrap{
		background: #FFFFFF;
		box-shadow: 0px 0px 16px rgba(0,0,0,0.05);
		border-radius: 16rpx;
		padding:20rpx;
	}
	.imgs{
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx;
	}
	.nums{
		color: #FFCB00;
	}
</style>
